import {GetLocalTrackFailedError} from "./error"
export default {
	/**
	 * 获取指定类型的本地视屏轨道
	 * @param {String} type [video|desktop|audio]
	 */
	async getLocalTrack(type) {
		let track;
		try{
			track = (await JitsiMeetJS.createLocalTracks({
				devices: [type]
			}))[0]
		}catch(error){
			throw new GetLocalTrackFailedError(type)
		}
		console.log(`local track got:${type}`)
		return track
	},
}